package com.yh.controller;

/**
 * @Auther:云尚学Java
 * 模板方法模式中的父类
 */
public abstract class HttpServlet extends GenericServlet1{
    //父类提供子类需要重写方法
    public abstract void doGet();
    public abstract void doPost();

    //父类提供重写方法调用场景
    @Override
    public void service(String method) {
        if("get".equalsIgnoreCase(method)){
            this.doGet();
        }else if("post".equalsIgnoreCase(method)){
            this.doPost();
        }
    }
}
